import request from '@/config/axios'

export const getAllBusinessCodeFromCacheApi = () => {
	return request.get<BusinessCodeCollection>({
		url: '/system/sys-business-code/readOnly/getAllBusinessCodeFromCache'
	})
}

export const saveBusinessCodeApi = (data: SaveBusinessCodeRequest) => {
	return request.post({
		url: '/system/sys-business-code/saveBusinessCode',
		data
	})
}

export const deleteBusinessCodeApi = (data: DeleteBusinessCodeRequest) => {
	return request.delete({
		url: '/system/sys-business-code/deleteBusinessCode',
		data
	})
}

export const getAllBusinessCodeByIdApi = (businessCodeId: number) => {
	return request.get<SysBusinessCodeDetailVo[]>({
		url: '/system/sys-business-code/readOnly/getAllBusinessCodeById/' + businessCodeId
	})
}

export const updateBusinessCodeValidApi = (data: { codeType: string, valid: number }) => {
	return request.put({
		url: '/system/sys-business-code/updateBusinessCodeValid',
		data
	})
}
